home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / spiele / sac / manual / chapter5.doc < prev    next >
Text File  |  2012-11-26  |  11KB  |  288 lines

  1.                          Chapter five
  2.  *****************************************************************
  3.                      Adding extra routines
  4.  *****************************************************************
  5.  
  6.   Well, we've got this far, and what we have is just a normal 
  7.   plain old adventure. But would'nt it be nice to give it that 
  8.   little something extra to make it stand out.
  9.  
  10.                              Music
  11.  
  12.   Has you know, Stos has his own music definer and used properly, 
  13.   it can be used to compose some rather catchy tunes. It can also 
  14.   be used to make all kinds of strange sounds which could be used 
  15.   in an adventure to liven it up a bit.
  16.  
  17.   At the moment, Sac games just load the title screen followed by 
  18.   the game data then start. Why not give them a title tune, this 
  19.   will give the player something to listen to while they wait for 
  20.   the game to finish loading.
  21.  
  22.   75 music 1
  23.   80 load"pic.pi1"
  24.   90 load"game.adv"
  25.  
  26.   This little program can be entered into a game and play a little 
  27.   tune. Line 75 expects to find some music in bank 3 and plays the 
  28.   first tune. Another idea would be to have a collection of tunes 
  29.   stored in bank 3 and played like this....
  30.  
  31.   75 R=rnd(20) : if R=0 then goto 75 
  32.   76 music R
  33.  
  34.   This would play a different title tune every time the game is 
  35.   loaded. Now lets say your game had a pub in it, this routine 
  36.   could be used as an H_P event to check that if the player enters 
  37.   a pub the jukebox is playing a different tune is playing each  
  38.   time he enters. The event would go like this...
  39.  
  40.   150 if LOC=12 then R=rnd(20) : music R
  41.  
  42.   Where location 12 is the location number of the pub.
  43.  
  44.   If you wanted a random tune to play between certain locations 
  45.   you could try this line.........
  46.  
  47.   150 if LOC>10 and LOC<20 then R=rnd(20) : music R
  48.  
  49.   This plays a random tune between locations 10 and 20.
  50.  
  51.   Another idea is to have a tune playing throughout the game by 
  52.   just adding a music statement at the start of the game.
  53.  
  54.   50 music 5
  55.  
  56.   As you can see, theres a lot of things you can do with music, 
  57.   and as Stos plays it on interupt, the game can do other things.
  58.  
  59.   If you want an impressive title tune then you can always play 
  60.   Stos Tracker music if you have the tracker extensions, but you 
  61.   can't play it throughout the game as it blocks the keyboard.
  62.  
  63.   75 track load"tune.abk",1 : track play 1
  64.   80 load"pic.pi1"
  65.   85 if track scan=48 then track stop
  66.  
  67.                              Sound
  68.  
  69.   As you know, Stos has its own sound commands which are Boom, 
  70.   Bell, and Shoot. It also has an Envelope command which can be
  71.   used to created all kinds of sounds. You could use the Boom 
  72.   command if the player attempts to light a match where theres gas 
  73.   about then print a message telling the player he has just be 
  74.   blown up. A L_P event could check this.
  75.  
  76.   3010 if WRD$(1)="light" and WRD$(2)="match" and LOC=15 then boom 
  77.        : print MESSAGE$(4) : goto 2610
  78.  
  79.   So location 15 could be a power station and lighting a match is 
  80.   dangerous. Shoot could be used if your adventure is about a 
  81.   gangster and he fires his gun at people.
  82.  
  83.   There is a program called Stos Sound Fx which allows you to make 
  84.   all different kinds of sounds by using the X-bios chip. This is 
  85.   availible from various PD librarys like MT Software.
  86.  
  87.                         Sampled Sound
  88.  
  89.   The main problem with sampled sound is that it takes up a lot of 
  90.   memory, how much depends on the speed and length of the sample.  
  91.   
  92.   You will have noticed that a Sac game does'nt use a lot of 
  93.   memory so you should be able to use a sample or two in it.
  94.  
  95.   For an example, a game where the player is in a haunted house 
  96.   you could record someone laughing, slow it down, add an echo 
  97.   effect to it and you could play it every time the player dies.
  98.   If you have Stos Maestro and sampler extensions you could store 
  99.   your laugh in an mbk file and use it if the player falls down a 
  100.   trapdoor to his doom, used as a H_P event.
  101.  
  102.   110 if LOC=18 then print MESSAGE$(1) : samplay 1 : goto 2610
  103.  
  104.   This line informs the player he has fallen through a trapdoor 
  105.   and the Samplay command plays the creepy laugh and goes to line 
  106.   2610 which ends the game. If you load Stos Maestro and look in 
  107.   the Sound folder you will see a file called LAUGH.SAM, try 
  108.   loading it into Maestro, adding echo and dropping the playback 
  109.   speed to five then play it. You'll hear an evil laugh.
  110.  
  111.   Here is another example with a L_P event.
  112.  
  113.   3020 if WRD$(1)="kill" and WRD$(2)="monster" and LOC=10 then 
  114.   samplay 4 : MONSTER=0 : print MESSAGE$(10)
  115.  
  116.   This line would play sample 4 which would be the sound of a   
  117.   monster screaming and message 4 informs the player that he has   
  118.   just killed the monster. Note the varible MONSTER, this has been   
  119.   set to 0 to indicate the monster is dead, the state of the 
  120.   monster can be check as an H_P event.
  121.  
  122.   150 if MONSTER=0 then print MESSAGE$(1)
  123.   160 if MONSTER=1 then print MESSAGE$(2)
  124.  
  125.   Message 1 would be...There is a dead monster here.
  126.   Message 2 would be...There is an ugly monster here
  127.  
  128.   So if MONSTER is set to 0 the monster is dead but if its set to 
  129.   1 then its alive. More about this later on.
  130.  
  131.   As you may or may not know, Maestro allows you to add different 
  132.   effects to samples such as Echo, Room and Hall to name but a 
  133.   few. Try recording a child saying 'mamma mamma', record it with 
  134.   Maestro at a speed of 12, add a Room effect to it then play it.
  135.   
  136.   What you hear sounds like the ghost of a child crying for its 
  137.   mother behind a wall. This move would certainly get the players
  138.   attention in an horror game.
  139.  
  140.   Another idea would be to record warriors battling with their 
  141.   swords, add Hall effect and play it when the player enters a 
  142.   loction where the ghost of long dead warriors still battle on.
  143.  
  144.   200 if LOC=30 then samloop on : samplay 5 else samloop off
  145.  
  146.   Here we see the use of the Samloop command, this could also be 
  147.   used if the player sees an helicopter.
  148.  
  149.   Theres thousands of effects you can create with music and sound 
  150.   which would certainly make your game stand out from the crowd.
  151.  
  152.                           Characters
  153.  
  154.   In adventure games, a character could be anything from a human 
  155.   to an animal, maybe even the odd monster of two, this can be 
  156.   used to make your game world more real.
  157.  
  158.   If you have been playing the example games on this disk, you 
  159.   will see that the game Haunted House has one called Ray. This is 
  160.   the main characters mate whos always complaining, in fact people 
  161.   may keep playing this game to see what Ray does next. This idea 
  162.   adds a bit of humour to the game. Lets see how its done.
  163.  
  164.   Load the creator, then load the file House.Adv from the House 
  165.   folder and select the Messages option. List the messages (l) and 
  166.   look at messages 18 to 30. These are Rays messages and as you 
  167.   see he gets up to all sorts.
  168.  
  169.   If you look at the source code for this game (house.bas) and 
  170.   look at the H_P events you will see this.
  171.  
  172.   350 RAY=rnd(30):if RAY<18 then goto 350
  173.   360 print MESSAGE$(RAY)
  174.  
  175.   So Ray stays with the player moving to the same location as them 
  176.   and carrys on grumbling and doing silly things.
  177.  
  178.   Line 350 tells Stos to choose a random message and if its less 
  179.   than 18, to go back and try again, this is because Rays messages 
  180.   are between 18 and 30.
  181.  
  182.   Heres another method that puts a character in random locations.
  183.  
  184.   370 L=rnd(40):if L=0 then goto 370
  185.   380 if L=LOC then print MESSAGE$(8)
  186.  
  187.   L= Location of the character
  188.   
  189.   LOC= Location of the player
  190.  
  191.   So if the character appears in the location the player enter 
  192.   then message 8 is printed.
  193.  
  194.                     Fighting a character
  195.  
  196.   Lets say that your adventure required you to kill a troll, now 
  197.   this troll could be killed with just one hit or may he's tough 
  198.   and can take a few hits. To kill him with one hit can be done 
  199.   with this line as a L_P event.
  200.  
  201.   3100 if WRD$(1)="kill" and WRD$(2)="troll" and TROLL=LOC then 
  202.        TROLL=0 : print MESSAGE$(10)
  203.  
  204.   So if the player types "kill troll" and the Troll is in the same 
  205.   location as the player then kill him off and print message 10.
  206.  
  207.   So when that location is entered again, an H_P event could tell 
  208.   the player the troll is dead.
  209.  
  210.   400 if TROLL=0 then print MESSAGE$(1)
  211.  
  212.   Or if he's alive.
  213.  
  214.   410 if TROLL=1 then print MESSAGE$(2)
  215.  
  216.   In chapter 6 I shall explain how a character is killed by a few 
  217.   hits with the same applying to the player.
  218.  
  219.   In this next example I will show you how to get a character to 
  220.   join a player when they meet.
  221.  
  222.   First lets define a character called Susan, this character will 
  223.   meet up with the player in the pub then go with him.
  224.  
  225.   First we define a varible to put Susan in the pub.
  226.  
  227.   80 SUSAN=10
  228.  
  229.   Where location 10 is the location number of the pub.
  230.  
  231.   Now we use an H_P event to check if the player meets up with 
  232.   her and to put them together.
  233.  
  234.   350 if LOC=10 and MEET=0 then MEET=1:print MESSAGE$(9)
  235.  
  236.   The varible MEET is used to check if the couple have met, if so 
  237.   it would be set to one, otherwise it would be set to 0.
  238.  
  239.   Message 9 would say something like......
  240.  
  241.   A girl comes over, tells you her name is Susan, and mentions 
  242.   that she's going with you.
  243.  
  244.   And finally, another H_P event to check if there still together.
  245.  
  246.   360 if MEET=1 then SUSAN=LOC : print MESSAGE$(15)
  247.  
  248.   Thats all for characters for now, maybe you can think of some 
  249.   more uses for them. The skys the limit.
  250.  
  251.                            Objects
  252.  
  253.   In a game of wizardry, your player could cast a spell to 
  254.   tranform an object from one location to the other like this.
  255.  
  256.   3200 if WRD$(1)="cast" and WRD$(2)="spell" then OBLOC(2)=10 : 
  257.   print MESSAGE$(7) : DONE=1
  258.  
  259.   This sends object 2 to location 10.
  260.  
  261.   You could use Not Created objects for different effects, for 
  262.   example, you could use an H_P event to tell the player that an 
  263.   elf has an axe. The axe would be defined as a Not Created object 
  264.   and created when the elf is killed.
  265.  
  266.   380 if ELF=LOC then print MESSAGE$(5)
  267.  
  268.   Where message 5 would say.. There is an elf here with an axe.
  269.  
  270.   Now we use a L_P event to kill the elf and make him drop the 
  271.   axe which would be moved from the Not Created location to the 
  272.   players present location then kill the elf.
  273.  
  274.   3210 if WRD$(1)="kill" and WRD$(2)="elf" then print MESSAGE$(2) :
  275.        OB_LOC(8)=LOC : ELF=0 : DONE=1 : SC0RE=SC0RE+100
  276.  
  277.   Now add the final H_P event to mention the elf is dead.
  278.  
  279.   390 If ELF=0 then print MESSAGE$(1)
  280.  
  281.   Well thats it for this chapter, I hope you find some useful 
  282.   ideas here to put in your games. Don't be afraid to try 
  283.   different ideas and if you get stuck, then drop me a line at the 
  284.   usual address and I'll try to put you on the right track.
  285.  
  286.   In chapter 6 we are going to write a small adventure game.
  287.  
  288.